package com.geek.nio3work.nio2.filter;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;

/**
 * @author lishuangqiang
 */
public class HeaderHttpRequestFilter implements HttpRequestFilter {


    @Override
    public String filterAndGetMethodName(FullHttpRequest fullRequest, ChannelHandlerContext ctx) throws Exception {
        String name = fullRequest.getMethod().name();
        if (!("get".equalsIgnoreCase(name) || "post".equalsIgnoreCase(name))) {
                throw new Exception("不支持的请求类型");
        }
        return name;

    }
}
